Content adaptive quality restoration filtering for high efficiency video coding

ABSTRACT

A system and method for impairments compensation filtering is described that can be used either in conjunction with video coding, or standalone for postprocessing. It uses a wiener filtering approach in conjunction with an efficient codebook representation.

FIELD

This disclosure relates to encoding and decoding of video signals, and more particularly, to codebook-based encoding and decoding of adaptive filters used for impairments compensation.

BACKGROUND

The advent of digital multimedia such as digital images, speech/audio, graphics, and video have significantly improved various applications as well as opened up brand new applications due to relative ease by which it has enabled reliable storage, communication, transmission, and, search and access of content. Overall, the applications of digital multimedia have been many, encompassing a wide spectrum including entertainment, information, medicine, and security, and have benefited the society in numerous ways. Multimedia as captured by sensors such as cameras and microphones is often analog, and the process of digitization in the form of Pulse Coded Modulation (PCM) renders it digital. However, just after digitization, the amount of resulting data can be quite significant as is necessary to re-create the analog representation needed by speakers and/or TV display. Thus, efficient communication, storage or transmission of the large volume of digital multimedia content requires its compression from raw PCM form to a compressed representation. Thus, many techniques for compression of multimedia have been invented. Over the years, video compression techniques have grown very sophisticated to the point that they can often achieve high compression factors between 10 and 100 while retaining high psycho-visual quality, often similar to uncompressed digital video.

While tremendous progress has been made to date in the art and science of video compression (as exhibited by the plethora of standards bodies driven video coding standards such as MPEG-1, MPEG-2, H.263, MPEG-4 part2, MPEG-4 AVC/H.264, MPEG-4 SVC and MVC, as well as industry driven proprietary standards such as Windows Media Video, RealVideo, On2 VP, and the like), the ever increasing appetite of consumers for even higher quality, higher definition, and now 3D (stereo) video, available for access whenever, wherever, has necessitated delivery via various means such as DVD/BD, over the air broadcast, cable/satellite, wired and mobile networks, to a range of client devices such as PCs/laptops, TVs, set top boxes, gaming consoles, portable media players/devices, and smartphones, fueling the desire for even higher levels of video compression. In the standards-body-driven standards, this is evidenced by the recently started effort by ISO MPEG in High Efficiency Video coding which is expected to combine new technology contributions and technology from a number of years of exploratory work on H.265 video compression by ITU-T standards committee.

All aforementioned standards employ a general interframe predictive coding framework that involves reducing temporal redundancy by compensating for motion between frames of video by first dividing a frame into blocks and assigning motion vector/s to each block of a frame to be coded, with respect to a past decoded frame; these motion vectors are then transmitted to the decoder and used to generate a motion compensated prediction frame that is differenced with a past decoded frame and coded block by block, often by transform coding. It has been long recognized that at high compression factors at which today's state of the art codecs operate, motion compensated transform coding process may generate coding artifacts that range from coding noise (e.g. mosquito effects), blockiness, bleeding, to ringing. In fact to mitigate some of these coding artifacts, most state of the art codecs include deblocking filters as well as sometimes ringing, as postprocessing filters. Often deblocking is done in-loop as compared to postprocessing that can be done out of loop. Often such deblocking is able to suppress visual quality artifacts but does not compensate for impairments introduced by the codec, nor is such deblocking able to give much coding quality gain.

Recognizing this, over last few years research effort has been underway to design additional filters that can improve both the visual and coding quality. Further, since coding quality can vary a lot depending on content of video sequences, contrast ratio, noise level, and operating bit-rates, it is desirable that the filters are adaptive rather than fixed to get maximum benefit of such a filter to improve prediction and thus help improve compression efficiency. The mathematical procedure used to compute filter coefficients is based on Wiener Hopf equation and computes filter coefficients (e.g. an array of 5×5 or 7×7 or 9×9 coefficients), which are either directly or differentially sent for each frame of every video sequence.

According to the basic theory of adaptive filtering, cross-correlation and autocorrelation matrices are accumulated, from which the optimal Wiener filter can be computed by solving the Wiener Hopf equation as follows.

Let x(n) be the input signal, y(n) be the output, and h(n) represent filter coefficients.

-   -   Filter output:

${y(n)} = {\sum\limits_{k = 0}^{N - 1}{{h(k)}{x\left( {n - k} \right)}}}$

-   -   Error signal:         e(n)=d(n)−y(n)     -   Mean Square Error:         J=E[e ²(n)]     -   In vector form:

${x(n)} = \begin{bmatrix} {x(n)} \\ {x\left( {n - 1} \right)} \\ \vdots \\ {x\left( {n - N + 1} \right)} \end{bmatrix}$ and $h = \begin{bmatrix} {h(0)} \\ {h(1)} \\ \vdots \\ {h\left( {N - 1} \right)} \end{bmatrix}$ y(n)=h ^(T) x(n)=x(n)^(T) h

$\begin{matrix} {{E\left\lbrack {e^{2}(n)} \right\rbrack} = {E\left\lbrack \left( {{d(n)} - {y(n)}} \right)^{2} \right\rbrack}} \\ {= {{E\left\lbrack {d^{2}(n)} \right\rbrack} - {2{E\left\lbrack {{d(n)}{x(n)}^{T}} \right\rbrack}h} + {h^{T}{E\left\lbrack {{x(n)}{x(n)}^{T}} \right\rbrack}h}}} \\ {= {P_{d} - {2R_{dx}^{T}h} + {h^{T}R_{xx}h}}} \end{matrix}$

-   -   Where, P_(d) is a scalar.     -   Crosscorrelation row vector:         R _(dx) =E[d(n)x(n)^(T)]     -   Autocorrelation matrix:         R _(xx) =E[x(n)x(n)^(T)]

To find minimum, the derivative is taken and set to zero as follows:

$\frac{\partial{E\left\lbrack {e^{2}(n)} \right\rbrack}}{\partial{h(k)}} = {{{{- 2}R_{dx}^{T}} + {2R_{xx}h}} = 0}$

Solving for h, the Wiener Hopf equation is as follows: h=R _(xx) ⁻¹ R _(dx)

The Wiener Hopf equation determines optimum filter coefficients in mean square error, and the resulting filter is called the ‘wiener’ filter.

In the above equation, h is the vector of filter coefficients, R_(xx) is the autocorrelation matrix (or block data of reference frame) and R_(dx) is a cross-correlation matrix/row vector (between the source frame and reference frame block data).

While the aforementioned mathematical procedure can calculate filter coefficients, there are significant issues in practical integration of this approach in a video coding system. In context of H.264 and H.265 development, a number of proposals have been made to address Picture Based (ALF); Block Based (ALF); Quad-tree Based (QALF); Spatial prediction of coefficients; Postfilter.

A limitation, however, is that the process is computationally expensive (non-separable filters require more computations than separable filters), iterative typically requiring 3-12 full iterations to compute filter coefficients, and further often requires sending of many coefficients (40-80 coefficients) per frame, which even when differentially coded can cost for instance around 300-600 bits per frame of Common Intermediate Format (“CIF”) resolution video, while offering at times limited gains (e.g, due to rounding of coefficients, standard coefficients being good match to the content etc). Further some methods send a macroblock or quad-tree based block map to indicate blocks where such filter is turned ‘on’ or ‘off’; this process can increase overhead bit cost by another 200-400 bits, such that the total bit cost per frame of 500-1000 bits. This makes such a system expensive in overhead bit cost, inflexible, and excessively complex.

Additional information related to adaptive filtering may be found in the following references, each of which is incorporated fully by reference, for all purposes:

-   -   T. Chujoh et al, “Block Based Adaptive Loop Filter,”         ITU-Telecommunications Standardization Sector, VCEG, VCEG-AI18,         Germany, July 2008.     -   T. Chujoh et al, “Specification and experimental results of         Quad-tree-based Adaptive Loop Filter,” ITU-Telecommunications         Standardization Sector, VCEG, VCEG-AK22, Japan, April 2009.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates an exemplary video encoding/decoding system according to one embodiment.

FIG. 2 illustrates several components of an exemplary encoding device, in accordance with one embodiment.

FIG. 3 illustrates several components of an exemplary decoding device, in accordance with one embodiment.

FIG. 4 illustrates an “offline” routine for generating a codebook representing a plurality of sets of Impairments-Compensation (“IC”) Filter Coefficients, in accordance with one embodiment.

FIGS. 5a-g show coefficient-pixel locations of various filters used in impairments compensation filtering, in accordance with various embodiments.

FIGS. 6a-d show exemplary coefficients of various filter used in impairments compensation filtering, in accordance with various embodiments.

FIG. 7 illustrates a video encoder including a IC Codebook Filter Encoder, in accordance with one embodiment.

FIG. 8 illustrates a video decoder including a IC Codebook Filter Decoder, in accordance with one embodiment.

FIG. 9 illustrates a IC Codebook Filter Encoder in accordance with one embodiment.

FIGS. 10a-f illustrate various organizations of pictures, to which various embodiments may be applied.

FIG. 11 illustrates a IC Codebook Filter Decoder in accordance with one embodiment.

FIG. 12 illustrates a fast IC Codebook Filter Encoder in accordance with one embodiment.

FIG. 13 illustrates a IC filter Codebook search routine, such as may be performed by an encoder in accordance with one embodiment.

FIG. 14 illustrates a fast IC Codebook Filter Encoder with a spectral update encoder, in accordance with one embodiment.

FIG. 15 illustrates a IC Codebook Filter Decoder in accordance with one embodiment.

FIGS. 16a-b illustrate an exemplary transform coefficient scanning and mask used by various embodiments.

FIG. 17 illustrates a fast IC Codebook Filter Encoder with a spectral update encoder and updatable codebook, in accordance with one embodiment.

FIG. 18 illustrates a IC Codebook Filter Decoder in accordance with one embodiment.

FIG. 19 illustrates an exemplary bitstream syntax for IC Codebook Filter encoders and decoders in accordance with various embodiments.

FIGS. 20a-b illustrates a sequence of pictures or frames within a video stream, in accordance with various embodiments.

FIG. 21 illustrates a routine for encoding a IC filter for a picture of a video into a bitstream using a codebook, in accordance with one embodiment.

FIG. 22 illustrates a IC filter coefficient-set update subroutine, in accordance with one embodiment.

FIG. 23 illustrates a routine for encoding and updating a IC filter for a picture of a video into a bitstream using one or more codebooks, in accordance with one embodiment.

FIG. 24 illustrates a routine for decoding a IC filter for a picture of a video from a bitstream using one or more codebooks, in accordance with one embodiment.

DETAILED DESCRIPTION

The detailed description that follows is represented largely in terms of processes and symbolic representations of operations by conventional computer components, including a processor, memory storage devices for the processor, connected display devices and input devices. Furthermore, these processes and operations may utilize conventional computer components in a heterogeneous distributed computing environment, including remote file Servers, computer Servers and memory storage devices. Each of these conventional distributed computing components is accessible by the processor via a communication network.

The phrases “in one embodiment,” “in various embodiments,” “in some embodiments,” and the like are used repeatedly. Such phrases do not necessarily refer to the same embodiment. The terms “comprising,” “having,” and “including” are synonymous, unless the context dictates otherwise.

Overview

As discussed below, in accordance with various embodiments, content adaptive techniques may be employed to perform impairments-compensation filter coefficients calculation and codebook-based representation to perform filtering to improve coding efficiency in motion-compensated video coding. Various systems and methods for impairments-compensation filtering of video to improve prediction efficiency of interframe video coding are described herein.

Various techniques, as described below, may be efficient in bits, as only an index to a filter stored in the codebook may be transmitted, as opposed to transmitting the filter itself. Coding an index is more efficient than coding actual coefficients or sending differentially encoded filter coefficients. While the number of actual indices sent depends on the number of partitions, the techniques described below may be more efficient in bit-rate than previous approaches using similar partition types.

The techniques described below may additionally offer reduced computational complexity, as unlike existing non-codebook based solutions, they may avoid the need to simultaneously compute wiener filters of different sizes (e.g. 5×5, 7×7, 9×9) and/or types (e.g., non-symmetric and point symmetric) and iteratively compute block maps where filters will be applied or not, and then again re-compute improved filters of these sizes and types to select the best candidate based on exhaustive rate distortion optimization. Instead, the techniques described below rely on content-based processing to decide filter sizes and filter types, while retaining the capability of using block-maps if desired. At the same time, the techniques described below may efficiently search a codebook to determine the best candidate.

Further, the techniques described below may offer flexibility, allowing the use of a codebook as is, while offering the ability to correct the best filter available from codebook with a spectral update in relatively few bits (which is still more efficient than sending coefficients themselves). The accuracy of the spectral update can be controlled. Additionally, the techniques described below allow portions of the codebook to be replaced or the codebook to be extended by adding corrected filters that may be better suited to the video sequence to be coded, thus increasing the overall efficiency of the codebook design.

The techniques described below also can work on pictures, slice groups, block maps, merged block maps, or adaptive partitions such as bi-tree, quad-tree, or content dependent regions. The ability of the techniques described below to work with content dependent partitions also reduces complexity and improves accuracy as compared to other techniques that are driven solely by rate distortion optimization.

Details of filter codebook design and efficient search of codebook are described below. With the described method of codebook design and for suggested codebook size, the techniques described below may result in good impairments compensation filtering, increasing prediction efficiency for a broad spectrum of video content.

In various embodiments, the techniques described below can be integrated in typical video coding that use traditional picture structures composed of I-, P-, B-picture coding. In other embodiments, the techniques described below can be integrated in video coding that uses other structures in addition to I-, and P-pictures, such as hierarchical B-pictures, unidirectional B-pictures, and/or B-picture alternatives.

In various embodiments, the codebook based Impairments-Compensation (“IC”) filtering described below can be used as in-loop without display of the filtered picture, in-loop with display of the filtered picture, and/or as post-processing-only with display of filtered picture. Its use in-loop may allow for compression efficiency gains in addition to visual quality improvement.

Reference is now made in detail to the description of the embodiments as illustrated in the drawings. While embodiments are described in connection with the drawings and related descriptions, there is no intent to limit the scope to the embodiments disclosed herein. On the contrary, the intent is to cover all alternatives, modifications and equivalents. In alternate embodiments, additional devices, or combinations of illustrated devices, may be added to, or combined, without limiting the scope to the embodiments disclosed herein.

FIG. 1 illustrates an exemplary video encoding/decoding system 100 according to one embodiment including an unencoded-video source 115, an encoding device 200 (see FIG. 2, discussed below), decoding device 300 (see FIG. 3, discussed below) with an optional external display 125, and an optional encoded-video source 120. In some embodiments, one or both of encoding device 200 and/or decoding device 300 may be connected to a network 150. In some embodiments, decoding device 300 and encoding device 200 may comprise a single device.

In some embodiments, other servers and/or devices (not shown) may also be present. For example, in some embodiments, a distribution server (not shown) may distribute encoded video to decoding device 300 via network 150.

In some embodiments, encoding device 200 may communicate with unencoded-video source 115 via network 150, a storage area network (“SAN”), a high speed serial bus, and/or via other suitable communication technology. Similarly, in some embodiments, decoding device 300 may communicate with encoded-video source 120 via network 150, a storage area network (“SAN”), a high speed serial bus, and/or via other suitable communication technology. In some embodiments, encoding device 200, decoding device 300, encoded-video source 120, and/or unencoded-video source 115 may comprise one or more replicated and/or distributed physical or logical devices.

In various embodiments, network 150 may include the Internet, a local area network (“LAN”), a wide area network (“WAN”), a cellular data network, and/or other data network. In many embodiments, there may be more encoding devices 200, decoding devices 300, encoded-video sources 120, and/or unencoded-video sources 115 than are illustrated.

FIG. 2 illustrates several components of an exemplary encoding device 200, in accordance with one embodiment. In some embodiments, encoding device 200 may include many more components than those shown in FIG. 2. However, it is not necessary that all of these generally conventional components be shown in order to disclose an illustrative embodiment. As shown in FIG. 2, encoding device 200 includes an optional network interface 230 for optionally connecting to the network 150.

The Encoding device 200 also includes a processing unit 210, a memory 250, an optional output device and/or display 240, and an optional input device 270 (e.g., a keyboard, mouse, remote, joy stick, and the like), all interconnected along with the optional network interface 230 via a bus 220. The memory 250 generally comprises a random access memory (“RAM”), a read only memory (“ROM”), and a permanent mass storage device, such as a disk drive. The memory 250 stores a IC filter Codebook 265, program code for a Video Encoder with IC Filtering 260, as well as a IC filter codebook generating routine 400 (see FIG. 4, discussed below), IC Filter Codebook Search routine 1300 (see FIG. 13, discussed below), IC Filter Codebook encoding routine (see FIG. 21, discussed below), and Multi-Codebook IC Filter Codebook encoding routine (see FIG. 23, discussed below). In addition, the memory 250 also stores an operating system 255. These software components may be loaded from a computer readable storage medium 295 into memory 250 of the Encoding device 200 using a drive mechanism (not shown) associated with a non-transient computer readable storage medium 295, such as a floppy disc, tape, DVD/CD-ROM drive, memory card, or the like. In some embodiments, software components may also be loaded via the optional network interface 230, rather than via a computer readable storage medium 295.

In some embodiments, encoding device 200 may further comprise a specialized interface 235 for communicating with unencoded-video source 115, such as a high speed serial bus, or the like. In some embodiments, encoding device 200 may communicate with unencoded-video source 115 via network interface 230. In other embodiments, unencoded-video source 115 may reside in memory 250.

Although an exemplary Encoding device 200 has been described that generally conforms to conventional general purpose computing devices, an encoding device 200 may be any of a great number of devices capable of encoding video, for example, a video recording device, a video co-processor and/or accelerator, a personal computer, a game console, a set-top box, a handheld computer, a cell phone, or any other suitable device.

FIG. 3 illustrates several components of an exemplary decoding device 300, in accordance with one embodiment. In some embodiments, decoding device 300 may include many more components than those shown in FIG. 3. However, it is not necessary that all of these generally conventional components be shown in order to disclose an illustrative embodiment. As shown in FIG. 3, decoding device 300 includes an optional network interface 330 for optionally connecting to the network 150.

The Decoding device 300 also includes a processing unit 310, a memory 350, an optional output device and/or display 340, and an optional input device 370 (e.g., a keyboard, mouse, remote, joy stick, and the like), all interconnected along with the optional network interface 330 via a bus 320. The memory 350 generally comprises a random access memory (“RAM”), a read only memory (“ROM”), and a permanent mass storage device, such as a disk drive. The memory 350 stores program code for a Video decoder with IC Filtering 360, a IC Filter Codebook 365 (a duplicate copy of IC Filter Codebook 265), program code for a IC Filtering Codebook decoder 360, and IC Filter Codebook decoding routine (see FIG. 24, discussed below). In addition, the memory 350 also stores an operating system 355. These software components may be loaded from a computer readable storage medium 395 into memory 350 of the Decoding device 300 using a drive mechanism (not shown) associated with a non-transient computer readable storage medium 395, such as a floppy disc, tape, DVD/CD-ROM drive, memory card, or the like. In some embodiments, software components may also be loaded via the optional network interface 330, rather than via a computer readable storage medium 395.

In some embodiments, decoding device 300 may further comprise a specialized interface 335 for communicating with encoded-video source 120, such as a high speed serial bus, or the like. In some embodiments, decoding device 300 may communicate with encoded-video source 120 via network interface 330. In other embodiments, encoded-video source 115 may reside in memory 350.

Although an exemplary Decoding device 300 has been described that generally conforms to conventional general purpose computing devices, an decoding device 300 may be any of a great number of devices capable of decoding video, for example, a video-play device, a personal computer, a game console, a set-top box, a handheld computer, a cell phone, or any other suitable device.

FIG. 4 illustrates an “offline” routine 400 for generating a codebook representing a plurality of sets of IC filter coefficients, in accordance with one embodiment. In some embodiments, routine 400 may take hours or even days to perform.

In block 405, a test set including a number of video sequences (e.g. 25 to 50), each with a number (e.g. 20-100) of frames, is obtained. In some embodiments, some or all of the video sequences may be selected from one or more pre-existing video sequences. In other embodiments, some or all of the video sequences may be developed for use with routine 400. In some embodiments, some or all of the video sequences may have a variety of characteristics, such as a high contrast, low contrast, high motion, low motion, bright, dark, and the like. In block 410, one or more filter sizes are selected. For example, in one embodiment, one or more of 5×5, 7×7, and 9×9 filter sizes may be selected. In block 415, one or more target bitrates are selected. For example, in one embodiment, one or more of low, medium, and high bitrates may be selected.

Beginning in starting loop block 420, each of the filter sizes is addressed in turn. Beginning in starting loop block 425, each of the video sequences is processed in turn. Beginning in starting loop block 430, each of the selected bitrates is addressed in turn. Beginning in starting loop block 435, each picture or frame within the current video sequence is processed in turn.

In block 440, the current picture is encoded by a video encoder. In block 445, the Wiener filter is computed for the current picture, filter size, and bitrate by comparing the encoded picture with the original un-encoded video. In block 450, the computed Wiener filter is stored at least temporarily as a candidate Wiener filter.

In ending loop block 455, routine 400 loops back to block 435 to process the next picture in the current video sequence (if any). In ending loop block 460, routine 400 loops back to block 430 to process the next bitrate (if any). In ending loop block 465, routine 400 loops back to block 425 to process the next video sequence (if any).

Once all pictures in all video sequences have been processed for each bitrate, in block 470, a subset (e.g. 256) of distinct Wiener filters from among the computed candidate Wiener filters is selected to cover a range of filter characteristics (e.g., from smooth to sharp) from low- to high-contrast.

In block 475, the subset of selected filters are sorted (e.g., in ascending order according to the center coefficient (or other representative parameter), e.g., from smooth to sharp (see FIGS. 6a-d ), and stored in a codebook of filter coefficients for the current filter size.

In ending loop block 480, routine 400 loops back to block 420 to process the next filter size (if any). Having generated a codebook for each filter size, routine 400 ends in block 499, the generated codebooks being made available for use by various encoders and decoders.

FIGS. 5a-d respectively illustrate sets of IC filter coefficients of 3×3, 5×5, 7×7, and 9×9 non-separable filters, such as may be used in impairments compensation filtering in various embodiments. For instance, as illustrated in FIG. 5a , in the case of 3×3 filtering, a filtered decoded picture is created pixel-by-pixel by applying 3×3 filter coefficients 505 with center coefficient c₁₁ aligned with the pixel being filtered using the weighted value of that pixel and the surrounding 5 pixels with weighting values given by the filter coefficients. Since the filter is non-separable, all 9 coefficients can have unique values. Similarly, as illustrated in FIG. 5d , for the case of 9×9 non-symmetric filtering, the pixel to be filtered is aligned with center coefficient c₄₄ and uses, in addition to that pixel, the surrounding 50 pixels, with each filtered pixel being a weighted combination of 51 pixels; the filtered pixels are written out as a separate filtered decoded picture that can be used as reference for prediction and perhaps even for display. In various embodiments, the coefficients 510, 515 illustrated in FIGS. 5b and 5c may be applied in a similar manner.

Likewise, FIGS. 5e-h respectively illustrate the coefficients of 3×3, 5×5, 7×7, and 9×9 point symmetric filters such as may be used in impairments compensation filtering in some embodiments. For instance, as illustrated in FIG. 5e , in case of 3×3 filtering, a filtered decoded picture is created pixel-by-pixel by applying 3×3 filter coefficients 525 with center coefficient c₁₁ aligned with pixel being filtered using the weighted value of that pixel and surrounding 5 pixels with weighting values given by the filter coefficients. Since the filter is point symmetric, only 5 coefficients c₀₀, c₀₁, c₀₂, c₁₀, c₁₁ can have unique values with other coefficients simply being diagonally symmetric. Similarly, as illustrated in FIG. 5h , for the case of 9×9 point symmetric filtering, only 41 coefficients are unique, the others being diagonally symmetric. The pixel to be filtered is aligned with center coefficient c₄₄ and uses, in addition to that pixel, the surrounding 50 pixels, with each filtered pixel being a weighted combination of 51 pixels; the filtered pixels are written out as a separate filtered decoded picture that can be used as reference for prediction and perhaps even for display. In various embodiments, the coefficients 530, 535 illustrated in FIGS. 5f and 5g may be applied in a similar manner.

FIG. 6a shows exemplary coefficients of a 9×9 non-separable ‘sharp’ filter used in impairments compensation filtering. FIG. 6b shows exemplary coefficients of a 9×9 point symmetric ‘sharp’ filter used in impairments compensation filtering. FIG. 6c shows exemplary coefficients of a 9×9 non-separable ‘smooth’ filter used in impairments compensation filtering. FIG. 6d shows exemplary coefficients of a 9×9 point symmetric ‘smooth’ filter used in impairments compensation filtering.

FIG. 7 shows a general block diagram of interframe encoder 700 employing motion compensated prediction and codebook-based in-loop impairments compensation filtering in accordance with one embodiment. One or more video frames (vidfrms) are provided to blocks indexer 701 and scene content analyzer 703. Scene content analyzer 703 analyzes the one or more video frames (vidfrms) and outputs a flag indicating scene changes (scnchg), as well as signals indicating image characteristics, such as scene contrast (contr), and region boundaries (regbnd) within the frame. Blocks indexer 701 divides the one or more video frames (vidfrms) into blocks (blks), which are input one a time to differencer 733 and differenced with corresponding prediction signal blocks (pred). Blocks (blks) are also provided to motion estimator 728 (discussed below). After differencing at differencer 733, the resulting residual (res) is forward transformed to a frequency-domain representation by transformer 735, resulting in a block of coefficients (tcof) that is then sent to the quantizer 738 resulting in a block of quantized coefficients (qcf) that are sent both to the entropy coder 718 and to the inverse quantizer 740. Inverse quantizer 740 sends de-quantized block of coefficients (tcof) to the inverse transformer 743. At adder 745, the prediction block (pred) from the motion compensation loop is added to the de-quantized residual block (res) at the output of inverse transformer 743. Adder 745 outputs the locally decoded block (rec), which is then sent to the frame assembler and deblock filter processor 748, which reduces the blockiness. The blocks (recd) at the output of frame assembler and deblock filtering processor 748 form a frame that is processed by IC Codebook Filter Encoder 750 to impairments-compensated reconstructed frame (recf), which is used as the reference frame for motion estimator 728 and motion compensated predictor 730. The motion estimator 728 computes motion vectors (my) between blocks (blks) of original video frame with respect to impairments-compensated reconstructed frame (recf). In some embodiments, the process of motion vector computation comprises computing an integer pel vector per block, followed by a subpel vector (e.g., to ¼ pel resolution). The entropy coder 718 encodes the quantized transform coefficients (qcf), differential motion vectors (dmv), and other data (including one or more signals 753 from IC Codebook Filter Encoder 750, generating a compressed bitstream 728. In some embodiments, entropy coder 718 may also provide a bit-count (btcnt) to IC Codebook Filter Encoder 750.

FIG. 8 shows a corresponding decoder, and works similarly to the local decoding loop 755 at the encoder 700. Specifically, the compressed bitstream 801 to be decoded is input to the entropy decoder 803, which decodes blocks of quantized coefficients (qcf), differential motion vectors (dmv), and other data, including control signals 818, which may be provided to IC Codebook Filter Decoder 820 (see, e.g., FIGS. 10, 13, 15, and 18, discussed below). The quantized coefficient blocks (qcf) are then inverse quantized by inverse quantizer 813, resulting in de-quantized coefficients (tcof′). De-quantized coefficients (tcof′) are then inverse transformed out of the frequency-domain by inverse transformer 815, resulting in decoded residual blocks (res′). Adder 823 adds motion compensated prediction blocks (pred) obtained by using corresponding motion vectors (my). The resulting decoded video (rec) is deblock-filtered in frame assembler and deblock filtering processor 825. Just as at the encoder 800, blocks (recd) at the output of frame assembler and deblock filtering processor 825 form a frame that is processed by IC Codebook Filter Decoder 820 to impairments-compensated reconstructed frame (recf), which is used as the reference frame for motion-compensated predictor 830. The motion compensated predictor 830 works in a similar manner as the motion compensated predictor 730 at the encoder 700, such as it uses a similar subpel interpolator.

FIG. 9 illustrates a IC Codebook Filter Encoder 900 in accordance with one embodiment. A video frame (not shown) is divided into blocks (blks), which are input one a time to Encoder 900. Also provided to Encoder 900 is reconstructed signal (recd).

Spatial Partitioner and Partitions Encoder 905 determines candidate partition map (cand. ptmap) and type (cand. pttyp), which are provided to Bitrate/Distortion Tradeoff Analyzer 908. For example, in one embodiment, candidate partition map (cand. ptmap) may comprise a binary map (if only two types of regions or blocks types exist), a trinary map (in case there are three types of regions or blocks), two binary maps, or the like.

Bitrate/Distortion Tradeoff Analyzer 908 selects a partition map (selected ptmap or simply ptmap) and partition type (selected pttyp or simply pttyp), which are returned to Spatial Partitioner and Partitions Encoder 905 and passed on to IC Filtering Processor 915. In addition, in some embodiments, partition map (ptmap) can be encoded into bitstream 928 by entropy coder 918 for transmission to a decoder. However, in its raw form (e.g., a 0/1 mask, or even multiple 0/1 masks) partition map (ptmap) may have a relatively high bit cost to transmit in raw form. Thus, in many embodiments, a compressed version of partition map (ptmap), referred to as coded partition map (ptmapc), is generated and encoded into bitstream 928 by entropy coder 918. If lossless compression is used, the decoder can decode coded partition map (ptmapc) and derive the exact partition map (ptmap) for use at the decoder. In various embodiments, the compression method used for encoding partition map (ptmap) to generate coded partition map (ptmapc) may include Huffman coding, run/length coding, arithmetic coding, or other like lossless coding technique. Furthermore, in some cases lossless compression may not sufficiently reduce the bit cost to transmit partition map (ptmap). In such cases, coded partition map (ptmapc) may be generated via a lossy compression technique.

In accordance with various embodiments, various different partitioning modes may be employed by Spatial Partitioner and Partitions Encoder 905 and/or Bitrate/Distortion Tradeoff Analyzer 908. In various embodiments, the methods described herein can be applied per frame, per region or segment, per group of slices, per single slice, per each quad-tree or bi-tree partitions of a frame, per group of macroblocks or blocks of a frame, per tile, per fragments of a tile, and/or by using tile, fragment, macroblock, or block map that may allow selection from among a number of available filters.

For example, FIGS. 10a-f illustrate various partitioning modes for dividing a picture in accordance with various embodiments. For instance, FIG. 10a illustrates picture-based partitioning, in which filter codes are only switched on a picture-by-picture basis. FIG. 10b illustrates slice or slice-group based partitioning such that a first filter set is applied on slice group ‘A’, and a second filter set is applied on slice group ‘B’. FIG. 10c illustrates a block map that identifies which filter to use for block type ‘A’ and which filter to use for block type ‘B’. FIG. 10d shows division of a picture into tiles and further division of tiles into bi-tree partitions such that various cuts of bi-tree based on rate-distortion optimization (“RDO”) are labeled as ‘A’ or ‘B’, indicating that they may correspondingly use a first or a second filter set. Likewise, FIG. 10e shows partitioning of a picture into tiles, and further partitioning of a tile into two types of quad-tree partitions labeled as ‘A or ‘B’ such that they may correspondingly use a first or a second filter set. Finally, FIG. 10f shows regions that result from merging of slices, or merging of blocks, or merging of bi-tree, or merging of quad-tree partitions, or purely by spatial segmentation.

Referring again to IC Codebook Filter Encoder 900 and FIG. 9, blocks (blks) are provided to Picture(s) Delay 925 and then to Cross Correlation Vector Calculator 923, which calculates cross-correlation matrix/row vector (R_(dx)) between source frame block data (blks) and reconstructed frame block data (recd). Auto Correlation Matrix Calculator 920 calculates autocorrelation matrix (R_(xx)) of reconstructed frame block data (recd).

IC Filter Codebook Search Processor 910 determines a filter size (fsz) (e.g., (e.g. 5×5, 7×7, 9×9, and the like) and mode (md) (e.g., non-symmetric or point symmetric) according to image characteristics of the input picture, such as scene change (scnchg) and contrast (contr). (See FIGS. 8a-h , discussed below.) For example, when the input picture is ‘low contrast,’ a large filter size (e.g. 9×9) may be determined. On the other hand when the input picture is ‘high contrast’, a small filter size (e.g. 5×5) may be determined if the coding quality is high, or a medium filter size (e.g., 7×7) if the coding quality is medium to low. For medium contrast scenes a medium filter size (e.g., 7×7) may be determined when coding quality is sufficient, or a large filter size (e.g., 9×9) when coding quality is low. In some embodiments, the filter size information is sent on a frame basis.

Using cross-correlation matrix/row vector (R_(dx)) and autocorrelation matrix (R_(xx)), IC Filter Codebook Lookup Table (“LUT”) and Address Logic 913 search within the IC Filter Codebook to locate a set of IC filter coefficients (icfc) that at least substantially fit with the computed target set of filter coefficients.

In some embodiments, the codebook search involves applying each individual set of IC filter coefficients to the entire reconstructed frame block data (recd). The winning set of filter coefficients is selected to be the set of filter coefficients that yields the smallest Sum of Absolute Differences (“SAD”) in respect to the original source frame block data (blks).

In other embodiments, the codebook search involves computing a comparison metric or matching criterion, such as the mean square error (“MSE”) of IC filters in the filter codebook, and selecting a set of filter coefficients that minimizes the comparison metric (e.g., MSE, SAD, and the like). For example, the calculation of MSE between two video frames, original frame pixels d(n) and filtered reconstructed frame pixels y(n) (obtained by filtering reconstructed frame pixels x(n)), involves finding sum of square of pixel by pixel difference between the two video frames and dividing by number of pixels in a video frame as follows.

${MSE} = {\frac{1}{\left( {{hsz} \times {vsz}} \right)}{\sum\limits_{n}\left( {{d(n)} - {y(n)}} \right)^{2}}}$ ${SSE} = {\sum\limits_{n}\left( {{d(n)} - {y(n)}} \right)^{2}}$ SSE=Σ(d(n))²+Σ(y(n))²−2Σd(n)y(n)

The general operation of filtering a signal x( ) using a filer h( ) resulting in filtered output y( ) can be written as: y(n)=Σh(k)x(n−k)

Substituting for y( ) in the sum of squares error (“SSE”) equation, SSE=Σ(d(n))²+ΣΣ(h(k)x(n−k))²−2Σd(n)(Σh(k)x(n−k))

This SSE equation is in fact same as the equation discussed during filter calculation, i.e., E[e ²(n))=P _(d) +h ^(T) R _(xx) h−2R _(dx) ^(T) h

To find minimum SSE given a set of filters, a filter is located that results in min(h^(T)R_(xx)h−2R_(dx) ^(T)h)

Further, the autocorrelation matrix R_(xx) or the cross-correlation vector R_(dx) does not depend on the filter h, and, in fact, both the R_(xx) and the R_(dx) were calculated earlier (during calculation of the best IC filter) for a given frame and thus can be reused.

Comparing the complexity of a correlation based approach to SSE calculation versus direct calculation of SSE (in terms of multiply operations), the complexity of actual filtering is of the order of hsz×vsz×taps (e.g., for CIF video and 81 tap filtering, 352×288×81=8,211,456), whereas the complexity of correlation approach is of the order of taps×taps+taps (e.g., for CIF video and 81 tap filtering, 81×81+81=6642, or over 1000 times less than that of actual filtering).

Referring again to FIG. 9, IC Filter Codebook LUT and Address Logic 913 therefore search within the IC Filter Codebook to locate a set of IC filter coefficients (icfc) that minimize MSE (or other matching criterion). The index (icfci) of the located set of IC filter coefficients (icfc), as well as the determined filter size (fsz) and mode (md), is provided to entropy encoder 918 for inclusion in bitstream 928. Using the located set of IC filter coefficients (icfc), IC Filtering Processor 915 filters at least a portion of the reconstructed signal (recd), as indicated by partition map (ptmap) and partition type (pttyp), to a impairments-compensated reconstructed signal (recf) that is objectively more faithful to the original source signal (represented by source frame block data (blks)) than the non-impairments-compensated reconstructed signal (recd).

FIG. 11 illustrates an IC Codebook Filter Decoder 1100 corresponding to Encoder 900, discussed above. Compressed bitstream 1101 to be decoded is input to the entropy decoder 1103, which decodes coded partition map (ptmapc), partition type (pttyp), a filter size (fsz), and an index (icfci) to a set of IC filter coefficients in a codebook of size fsz.

Coded partition map (ptmapc) and partition type (pttyp) are provided to Spatial Partitions Decoder 1105, which decodes coded partition map (ptmapc) and provides decoded partition map (ptmap) to IC Filtering Processor 1108.

Filter size (fsz) and index (icfci) are provided to IC Filter Codebook LUT and Address Logic 1113, which obtains IC filter coefficients (icfc) from the codebook and provides IC filter coefficients (icfc) to IC Filtering Processor 1108. IC Filtering Processor 1108 applies IC filter coefficients (icfc) to reconstructed signal (recd), generating an impairments-compensated reconstructed signal (recf).

FIG. 12 illustrates a fast IC Codebook Filter Encoder 1200 in accordance with one embodiment. IC Codebook Filter Encoder 1200 is similar in many respects to IC Codebook Filter Encoder 900, discussed above. However, unlike IC Codebook Filter Encoder 900, Wiener Filter Calculator 1230 uses cross-correlation matrix/row vector (R_(dx)) and autocorrelation matrix (R_(xx)) to compute a target set of filter coefficients (calc.icfc) for a Wiener filter of the given filter size (fsz) and mode (md). Approximate Match Calculator 1233 uses the target Wiener filter coefficients (calc.icfc) to locate within the IC Filter Codebook a set of IC filter coefficients that approximately match the computed target set of filter coefficients (calc.icfc). For example, in one embodiment, the approximately matching set of IC filter coefficients is determined to be the set of coefficients having the closest representative coefficient, such as a center coefficient, to that of the target set of filter coefficients (calc.icfc). In one embodiment, the search for the closest center coefficient is performed via a binary search algorithm, as sets of coefficients in the IC Filter Codebook are sorted according to center coefficient.

Once Approximate Match Calculator 1233 has located the approximately matching set of IC filter coefficients, IC Filter Codebook Search Processor 1210 determined a neighborhood radius R (e.g. 8 or 16), which is used to select a comparison group of 2R+1 sets of filter coefficients including R filters before and R filters after the approximately matching set of IC filter coefficients in the IC Filter Codebook.

IC Filter Codebook Search Processor 1210 then searches the neighborhood comparison group to determine a set of IC filter coefficients (icfc) that minimize MSE (or SAD, or other matching criterion). In some embodiments, IC Filter Codebook Search Processor 1210 further searches up to eight possible variations (rotations and flips or mirrorings) of each set of filter coefficients in the neighborhood comparison group.

Once a good set of IC filter coefficients (icfc) are located, the index (icfci) (as well as the determined filter size (fsz) and mode (md)) is provided to entropy encoder 1218 for inclusion in bitstream 1228 (along with one or more additional bitstream descriptors illustrated in FIG. 19, discussed below).

FIG. 13 illustrates a IC Filter Codebook search routine 1300, such as may be performed by an encoder in accordance with one embodiment. In block 1305, routine 1300 obtains an unencoded picture or frame of video. In block 1310, routine 1300 encodes the picture at a certain bitrate with a video encoder. In some embodiments, the video encoder may be an interframe encoder. In other embodiments, the video encoder may be an intraframe encoder. In block 1315, routine 1300 locally decodes the encoded picture at the video encoder via an in-loop local decoder.

In block 1320, routine 1300 determines the contrast (e.g., low, medium, or high) of the original, unencoded picture. In block 1325, routine 1300 selects a filter size (fsz) according to the determined contrast. For example, in one embodiment, routine 1300 may select a small filter size (e.g., 5×5) when the contrast is high, a medium or large filter size (e.g., 7×7 or 9×9) when the contrast is low, and a large filter size (e.g., 9×9) otherwise.

In block 1330, routine 1300 selects a filter type (e.g., non-symmetric or symmetric) according to some or all of the encoding bitrate, the determined contrast, or other like factors.

In block 1335, routine 1300 computes coefficients for a target Wiener filter of the selected size (fsz) of the locally decoded picture with regard to the original picture, using the locally decoded picture as the reference signal and the original unencoded picture as the desired signal. In block 1340, routine 1300 selects a comparison group including one or more candidate IC Filters from a codebook. In some embodiments, the one or more candidate IC Filters may be selected by locating an approximately-matching filter from the codebook (e.g., the IC Filter having a close or the closest center coefficient to that of the target Wiener filter), and then selecting several (e.g., 8 or 16) neighboring filters on either side of the approximately-matching filter. In some embodiments, the neighborhood comparison group may further include one or more variations or transformations of each of the candidate IC Filters. For example, non-symmetric filters have four rotation variations and four mirroring variations, while symmetric filters have four rotation variations.

Beginning in opening loop block 1345, routine 1300 processes each of the one or more candidate IC filters, determining in block 1350 an error estimate (e.g., SAD, MSE, or the like) for the current candidate IC filter, and looping back from block 1355 to process the next candidate IC filter (if any). In block 1360, routine 1300 selects the candidate IC filter having a low determined error estimate. In some embodiments, routine 1300 may select the candidate IC filter having the lowest determined error estimate.

In decision block 1365, routine 1300 determines whether the selected IC filter represents an improvement compared to no IC filter. For example, in one embodiment, routine 1300 determines whether the error estimate (e.g., SAD, MSE, or the like) of the decoded picture after IC filtering with the selected IC filter (compared to the original unencoded picture) is lower than an error estimate of the decoded picture with no IC filtering. If the selected IC Filter does not provide an improvement, then in block 1370, a one-bit filter-sent flag (fsnt) in the encoded bitstream is set to 0. On the other hand, if the selected IC Filter provides an improvement, then in block 1375, the one-bit filter-sent flag (fsnt) in the encoded bitstream is set to 1, and in block 1380, an index of the selected IC filter from the codebook (icfci) is set in the encoded bitstream. In some embodiments, routine 1300 may further set a signal (flt_ornt) (not shown) indicating a variation or transformation of the selected IC filter (e.g., indicating a rotation or mirroring variation on the selected IC filter). (See FIG. 19, discussed below, for a more detailed explanation of bitstream syntax.) Routine 1300 ends in block 1399.

FIG. 14 illustrates a fast IC Codebook Filter Encoder 1400 with a spectral update encoder, in accordance with one embodiment. IC Codebook Filter Encoder 1400 is similar in many respects to fast IC Codebook Filter Encoder 1200, discussed above. However, unlike IC Codebook Filter Encoder 1200, IC Codebook Filter Encoder 1400 is able to spectrally encode updates to the IC filter coefficients (icfc) selected by IC Filter Codebook LUT and Address Logic 1413, as follows.

Wiener Filter Calculator 1430 uses cross-correlation matrix/row vector (R_(dx)) and autocorrelation matrix (R_(xx)) to compute a target set of filter coefficients (calc.icfc) for a Wiener filter of the given filter size (fsz) and mode (md). As in IC Codebook Filter Encoder 1200, Approximate Match Calculator 1433 uses the target Wiener filter coefficients (calc.icfc) to locate within the IC Filter Codebook a set of IC filter coefficients that approximately match the computed target set of filter coefficients (calc.icfc).

However, unlike IC Codebook Filter Encoder 1200, Wiener Filter Calculator 1430 also provides target Wiener filter coefficients (calc.icfc) to differencer 1435, where they are differenced with corresponding selected IC filter coefficients (icfc).

After differencing at differencer 1435, the resulting coefficient differential (icfcd) adjustment values are forward transformed to a frequency-domain representation by transformer 1438, resulting in a block of transformed differential coefficients that is then sent to the quantizer 1440. Quantizer 1440 quantizes the block of transformed differential coefficients according to a quantization parameter (qp, also sometimes referred to as quantization scale) into a block of quantized transformed differential coefficients that are sent both to scanner 1443 and to inverse quantizer 1445. Scanner 1443 scans the block of quantized transformed differential coefficients according to a reverse-scanning order (see FIG. 16a , discussed below) and provides the scanned transform-coded differential coefficients (tcod.iccof) to entropy encoder 1418 for encoding into bitstream 1428 if indicated by update signal (updt) (discussed below).

Inverse quantizer 1445 de-quantizes the block of quantized transformed differential coefficients according to quantization parameter (qp) and sends the de-quantized transformed differential coefficients to the inverse transformer 1448. At adder 1450, the inverse-transformed de-quantized differential coefficients are added to the selected IC filter coefficients (icfc) from IC Filter Codebook LUT and Address Logic 1413 to form updated IC filter coefficients (icfcu).

Controller 1455 sends an update signal (updt) to Switch 1453, indicating whether Switch 1453 should send to IC Filtering Processor 1415 either the selected IC filter coefficients (icfc) or updated IC filter coefficients (icfcu). To determine update signal (updt), Controller 1455 uses picture-type signal (pictyp) (e.g., I-, P-, or B-picture types) and significance signal (sigf). Significance signal (sigf) is a thresholding choice made at IC Codebook Filter Encoder 1400 that indicates whether the difference between selected IC filter coefficients (icfc) and the target IC filter coefficients (calc.icfc) exceeds a pre-determined significance threshold. If the difference exceeds the threshold, then update signal (updt) indicates to Switch 1453 that updated IC filter coefficients (icfcu) should be used by IC Filtering Processor 1415. In addition, update signal (updt) is also encoded to bitstream 1428 by entropy coder 1418.

FIG. 15 illustrates a IC Codebook Filter Decoder 1500 corresponding to IC Codebook Filter Encoder 1400, discussed above. Compressed bitstream 1501 is input to the entropy decoder 1503, which decodes coded partition map (ptmapc), partition type (pttyp), a filter size (fsz), an update signal (updt), scanned transform-coded differential coefficients (tcod.iccof), and an index (icfci) to a set of IC filter coefficients in a codebook of size fsz.

Coded partition map (ptmapc) and partition type (pttyp) are provided to Spatial Partitions Decoder 1505, which decodes coded partition map (ptmapc) and provides decoded partition map (ptmap) to IC Filtering Processor 1508.

Filter size (fsz) and index (icfci) are provided to IC Filter Codebook LUT and Address Logic 1510, which obtains IC filter coefficients (icfc) from the codebook.

Inverse Scanner 1513 inverse-scans scanned differential transform-coded coefficients (tcod.iccof) according to a reverse-scanning order (see FIG. 16a , discussed below) to obtain a block of quantized transformed differential coefficients. Inverse quantizer 1515 de-quantizes the block of quantized transformed differential coefficients according to quantization parameter (qp) and sends the de-quantized transformed differential coefficients to the inverse transformer 1520. At adder 1523, the inverse-transformed de-quantized differential coefficient adjustment values are added to the selected IC filter coefficients (icfc) to form updated IC filter coefficients (icfcu).

Switch 1525 determines (according to update signal (updt)) whether to provide the selected IC filter coefficients (icfc) or updated IC filter coefficients (icfcu) to IC Filtering Processor 1508. IC Filtering Processor 1508 applies the provided coefficients to reconstructed signal (recd), generating an impairments-compensated reconstructed signal (recf).

FIG. 16a illustrates an exemplary transform coefficient reverse scanning used by IC Codebook Filter Decoder 1500 and IC Codebook Filter Encoder 1400. Generally speaking, transform coefficients are often scanned in a zigzag order beginning with a DC coefficient (e.g., 1605). However, in the illustrated reverse-scanning, transform coefficients may be scanned in a zigzag order ending with DC coefficient 1605.

FIG. 16b illustrates an exemplary transform mask that may be used in connection with coefficient reverse scanning used by IC Codebook Filter Decoder 1800 and IC Codebook Filter Encoder 1700. As illustrated in FIG. 16b , a coefficient mask (depicted in shaded cells 1615A-D and the other 20 unlabeled shaded cells) may be employed to indicate AC transform coefficients to include (or, alternately, to be omitted) when scanning in a zigzag order ending towards DC coefficient 1605.

FIG. 17 illustrates a fast IC Codebook Filter Encoder 1700 with a spectral update encoder and updatable codebook, in accordance with one embodiment. IC Codebook Filter Encoder 1700 is similar in many respects to IC Codebook Filter Encoder 1400, discussed above. However, unlike IC Codebook Filter Encoder 1400, IC Codebook Filter Encoder 1700 is able to store updated IC filter coefficients (icfcu) in the codebook as follows. Controller 1755 indicates that the codebook should be updated to store updated IC filter coefficients (icfcu) via store signal (str). Store signal (str) is used by Switch 1758 to determine whether to store updated IC filter coefficients (icfcu) in the codebook. Store signal (str) is also encoded by entropy encoder 1718 to bitstream 1728. In some embodiments, Controller 1755 may also indicate a codebook reset signal (not shown) indicating that stored updates should be discarded, the codebook reverting to its standard form (e.g., at a scene change).

IC Codebook Filter Encoder 1700 also differs from IC Codebook Filter Encoder 1400 in that transform coefficient mask (see FIG. 16b , discussed above) is used after transforming operations (mask 1758) and before inverse transforming operations (unmask 1760).

FIG. 18 illustrates a IC Codebook Filter Decoder 1800 corresponding to IC Codebook Filter Encoder 1700, discussed above. Filter Decoder 1800 is similar in many respects to IC Codebook Filter Decoder 1500, discussed above. However, unlike IC Codebook Filter Decoder 1500, IC Codebook Filter Decoder 1800 is able to store updated IC filter coefficients (icfcu) in the codebook as follows. Store signal (str) is decoded by entropy decoder 1803 from bitstream 1801. Store signal (str) is used by Switch 1758 to determine whether to store updated IC filter coefficients (icfcu) in the codebook. In some embodiments, entropy decoder 1803 may also decode a codebook reset signal (not shown) indicating that stored updates should be discarded, the codebook reverting to its standard form.

FIG. 19 illustrates an exemplary bitstream syntax 1900 for IC Codebook Filter encoders and decoders and variously described herein. Bitstream syntax 1900 begins with 2-bit header cicf_hdr 1901. One-bit pict_only flag 1902 indicates whether a single IC Filter is specified for the entire picture. Optional 3-bit numpt field 1903 indicates a number of partitions (up to eight). Optional 1-bit map_sent flag 1904 indicates whether a partition map is sent to indicate where the filter is applied or not, or alternatively, to switch between multiple filters. Optional n-bit ptmap field 1905 includes the partition map (if any).

One-bit fsnt flag 1906 indicates whether a IC Filter is included in the bitstream. If flag 1906 is set, then optional 1- or 2-bit field fsz 1907 indicates a filter size (e.g., 5×5, 7×7, or 9×9) of the included IC Filter, followed by a codeword for the selected filter. The codeword includes 8-bit icfci field 1908 (an index into a codebook of IC Filters) and 2-bits (separable filters) or 3-bits (non-separable filters) in flt_ornt field 1909 indicating the filter's variation or transformation that should be applied to the coefficients indicated by index icfci 1908 (e.g., one of four rotations for separable filters, or one of four rotations and four mirrorings for non-separable filters). Optional 1-bit updt flag 1910 indicates whether the bitstream includes a differential update to the coefficients indicated by index icfci 1908. Optional s-bit updt_dat field 1911 includes a differential update to be applies to the coefficients indicated by index icfci 1908. When indicated by pict_only flag 1902, fields 1906-1911 repeat numpt 1903 times.

FIG. 20a illustrates a sequence of pictures or frames 2001-2008 within a video stream, including I-frames 2001, 2008, P-frames 2004, 2006, and B-frames 2002-2003, 2005, 2007. FIG. 20b illustrates a sequence of pictures or frames 2001-2008 within a video stream, including I-frames 2001, 2008, which are partitioned into three exemplary partitions (numpt=3); P-frames 2004, 2006, which are partitioned into three exemplary partitions (numpt=3); and B-frames 2002-2003, 2005, 2007, which are partitioned into two exemplary partitions (numpt=2). Table 1 indicates an exemplary coding bit cost for encoding IC Codebook Filters according to various combinations of picture type and number of partitions (numpt). (The exemplary coding bit costs shown in Table 1 exclude bit costs for spatial partition maps such as regions, slices, tiles or tile fragments, picture bi-tree or quad-tree, tile bi-tree or quad-tree, and/or merged blocks.)

TABLE 1 Number of Filter Sets and Approx. Coding bits cost numpt = 1 numpt = 2 numpt = 3 numpt = 4 Picture Type Approx. Approx. Approx. Approx. (and IC filtering Num Bits Num Bits Num Bits Num Bits mode) Filt. cost Filt. cost Filt. cost Filt. cost I (no update) 1 16 2 33 3 46 4 59 P (no update) 1 16 2 33 3 46 4 59 B (no update) 1 16 1 16 2 33 2 33

FIG. 21 illustrates a routine 2100 for encoding a IC filter for a picture of a video into a bitstream using a codebook, in accordance with one embodiment. In block 2105, routine 2100 obtains a codebook including a plurality of sets of IC filter coefficients suitable for configuring an impairments compensation filter of a video decoder to process frames of encoded videos having a variety of characteristics (e.g., high contrast, low contrast, and the like). In one embodiment, the codebook may include 256 sets of filter coefficients, sorted according to a representative coefficient (e.g., sorted according to center coefficient). Other embodiments may include smaller or larger codebooks, sorted according to different criteria.

Beginning in starting loop block 2110, routine 2100 processes each picture or frame of a video. In block 2115, routine 2100 analyzes the current picture. For example, in one embodiment, routine 2100 may determine one or more image characteristics, such as a contrast level and/or whether the current picture represents a scene change compared to a previous picture.

In block 2120, routine 2100 determines one or more portions of the current picture. For example, FIGS. 10a-f , discussed above, illustrate various exemplary portions into which a picture may be divided, according to various embodiments. In some embodiments, the number of portions that routine 2100 determines may be determined, at least in part, according to a picture type of the current picture. (See, e.g., FIG. 20b , discussed above.)

In block 2125, routine 2100 encodes one or more picture-portion indicators to a bitstream. For example, in one embodiment, routine 2100 may encode one or more of fields 1902-1905, as illustrated in FIG. 19 and discussed above.

Beginning in starting loop block 2130, routine 2100 processes each of the one or more determined picture portions. In block 2150, routine 2100 adaptively selects a set of IC coefficients from the codebook to improve how faithfully the video decoder reproduces the current picture-portion when the set of IC coefficients is used to configure the decoder's impairments compensation filter to process the current picture-portion. FIGS. 12, 14, and 17, discussed above, illustrate various methods of adaptively selecting a set of IC coefficients from the codebook. For example, in one embodiment, adaptively selecting the set of IC coefficients may include some or all of encoding the unencoded picture, decoding the encoded picture in a local decoder loop; computing a target set of IC filter coefficients according to the decoded picture and the unencoded picture, and selecting from the codebook a set of IC filter coefficients that substantially fits with the target set of IC filter coefficients. In some embodiments, selecting IC filter coefficients that substantially fit with the target set may include selecting an approximately-matching set of coefficients according to a representative coefficient (e.g., the center coefficient) and identifying a comparison group of IC filters neighboring the approximately-matching set of coefficients. IC filters in the comparison group (including zero or more variations of each) may then be scored by determining error estimates (e.g., MSE), with the lowest-scoring set of IC filter coefficients being selected.

In block 2155, routine 2100 determines a filter indicator, such as an index into the codebook, for the selected set of IC coefficients. In block 2160, routine 2100 encodes the filter indicator into the bitstream to enable a decoder to locate the selected set of IC coefficients from the decoder's copy of the codebook.

In decision block 2165, routine 2100 determines whether to send an update to the selected set of IC coefficients to further improve how faithfully the video decoder reproduces the current picture-portion compared to the selected set of IC coefficients as stored in the codebook. In some embodiments, the update mechanism may not be used, in which case, the determination in block 2165 may always be negative. In embodiments that use an update mechanism, routine 2100 may determine whether the updated IC coefficients would improve the reproduction fidelity to a sufficient degree to justify the bit cost of sending the update. If an update is determined, then in subroutine block 2200 (see FIG. 22, discussed below) adjustment values are determined and encoded to update the selected set of IC coefficients at the decoder. In some embodiments, the adjustment values may include quantized transform coefficients representing differentials between calculated filter coefficients and the approximate match found from the codebook.

In ending loop block 2190, routine 2100 loops back to block 2130 to process the next picture-portion (if any). In ending loop block 2195, routine 2100 loops back to block 2110 to process the next picture (if any). Once all pictures have been processed, routine 2100 ends in block 2199.

FIG. 22 illustrates a IC filter coefficient-set update subroutine 2200, in accordance with one embodiment. In block 2205, subroutine 2200 determines a set of adjustment values for adjusting a codebook-stored set of IC filter coefficients. For example, in one embodiment, the adjustment values may include differential coefficient values between the codebook-stored set and a target set of IC filter coefficients.

In block 2210, subroutine 2200 encodes the adjustment values to a bitstream to enable a decoder to obtain the adjustment values. In some embodiments, encoding the adjustment values may include computing a frequency-domain representation of the adjustment values and entropy coding the frequency-domain representation according to a reverse zigzag scan order, possibly including only a masked subset of AC coefficients (see, e.g., FIG. 16b , discussed above).

In block 2215, subroutine 2200 encodes into the bitstream an adjustment indicator directing the video decoder to adjust the codebook-stored set of IC filter coefficients according to the encoded adjustment values before configuring the decoder's impairments compensation filter to process the current portion of the current picture. (See, e.g., bit fields 1910-1911, as illustrated in FIG. 19 and discussed above.)

In decision block 2220, subroutine 2200 determines whether to store the adjusted set of IC filter coefficients in the codebook so that the updated IC filter coefficients can be re-used without sending the adjustment values again. If so, then in block 2225, subroutine 2200 stores the adjusted set of IC filter coefficients in the encoder's local copy of the codebook, and in block 2230, subroutine 2200 encoder a store indicator to the bitstream adjustment indicator directing the video decoder to store the adjusted coefficient values in the decoder's copy of the codebook. In some embodiments, the store mechanism may not be used, in which case, the determination in block 2220 may always be negative. In embodiments that use the store mechanism, routine 2100 may determine whether the adjusted IC coefficients are likely to be subsequently re-used. Subroutine 2200 ends in block 2299.

FIG. 23 illustrates a routine 2300 for encoding a IC filter for a picture of a video into a bitstream using one or more codebooks, in accordance with one embodiment. In block 2305, routine 2300 obtains one or more codebooks, each including a plurality of sets of coefficients for a IC filter of a given size. In one embodiment, each codebook may include 256 sets of filter coefficients, sorted according to a representative coefficient (e.g., sorted according to center coefficient). Other embodiments may include smaller or larger codebooks, sorted according to different criteria. In one embodiment, one or more of the codebooks may include coefficients for IC filters of size 3×3, 5×5, 7×7, 9×9, 11×11, and the like.

Beginning in starting loop block 2310, routine 2300 processes each picture or frame of a video. In block 2315, routine 2300 analyzes the current picture. For example, in one embodiment, routine 2300 may determine one or more image characteristics, such as a contrast level and/or whether the current picture represents a scene change compared to a previous picture.

In block 2320, routine 2300 determines one or more portions of the current picture. For example, FIGS. 10a-f , discussed above, illustrate various exemplary portions into which a picture may be divided, according to various embodiments. In some embodiments, the number of portions that routine 2300 determines may be determined, at least in part, according to a picture type of the current picture. (See, e.g., FIG. 20b , discussed above.)

In block 2325, routine 2300 encodes one or more picture-portion indicators to a bitstream. For example, in one embodiment, routine 2300 may encode one or more of fields 902-1905, as illustrated in FIG. 19 and discussed above.

In block 2326, routine 2300 determines a filter size for the current picture. In block 2327, routine 2300 encodes the determined filter size to the bitstream (see, e.g, field 1907 in FIG. 19, discussed above.) For example, when the current picture is ‘low contrast,’ a larger filter size (e.g. 9×9) may be determined. On the other hand when the input picture is ‘high contrast’, a smaller filter size (e.g. 5×5) may be determined if the coding quality is high, or a medium filter size (e.g., 7×7) if the coding quality is medium to low. For medium-contrast scenes, a medium filter size (e.g., 7×7) may be determined when coding quality is sufficient, or a large filter size (e.g., 9×9) when coding quality is low. In some embodiments, the filter size information is sent on a picture or frame basis. In other embodiments, filter size information may be determined and sent for each portion of a picture (not shown).

In block 2328, routine 2300 selects a codebook having sets of coefficients for IC filters of the selected size. Beginning in starting loop block 2330, routine 2300 processes each of the one or more determined picture portions.

In block 2350, routine 2300 adaptively selects a set of IC coefficients from the codebook to improve how faithfully the video decoder reproduces the current picture-portion when the set of IC coefficients is used to configure the decoder's impairments compensation filter to process the current picture-portion.

In block 2355, routine 2300 determines a filter indicator, such as an index into the codebook, for the selected set of IC coefficients. In block 2360, routine 2300 encodes the filter indicator into the bitstream to enable a decoder to locate the selected set of IC coefficients from the decoder's copy of the codebook.

In decision block 2365, routine 2300 determines whether to send an update to the selected set of IC coefficients to further improve how faithfully the video decoder reproduces the current picture-portion compared to the selected set of IC coefficients as stored in the codebook. In some embodiments, the update mechanism may not be used, in which case, the determination in block 2365 may always be negative. In embodiments that use an update mechanism, routine 2300 may determine whether the updated IC coefficients would improve the reproduction fidelity to a sufficient degree to justify the bit cost of sending the update. If an update is determined, then in subroutine block 2200 (see FIG. 22, discussed above) adjustment values are determined and encoded to update the selected set of IC coefficients at the decoder.

In ending loop block 2390, routine 2300 loops back to block 2330 to process the next picture-portion (if any). In ending loop block 2395, routine 2300 loops back to block 2310 to process the next picture (if any). Once all pictures have been processed, routine 2300 ends in block 2399.

FIG. 24 illustrates a routine 2400 for decoding a IC filter for a picture of a video from a bitstream using one or more codebooks, in accordance with one embodiment. In block 2403, routine 2400 obtains one or more codebooks, each including a plurality of sets of coefficients for a IC filter of a given size. These codebooks are copies of the codebooks available to encoding routines 2200 and/or 2400, discussed above.

In block 2405, routine 2400 obtains an encoded bitstream including encoded data corresponding to a plurality of pictures or frames of a video. Beginning in starting loop block 2408, routine 2400 processes each picture encoded in the bitstream.

In decision block 2410, routine 2400 determines whether to reset one or more of the codebooks according to one or more reset signals encoded into the bitstream. For example, in one embodiment, the encoder may direct routine 2400 to reset codebooks at scene changes or at other times. If a reset signal in the bitstream indicates that one or more of the codebooks should be reset (i.e., any previous updates discarded), then in block 2413 the indicated codebook(s) are reverted to their original state.

In block 2415, routine 2400 decodes the current encoded picture. In block 2418, routine 2400 decodes one or more picture-portion indicators from the bitstream. For example, in one embodiment, routine 2400 may decode one or more of fields 1902-1905, as illustrated in FIG. 19 and discussed above.

Beginning in starting loop block 2420, routine 2400 processes each of the one or more indicated picture-portions. In block 2423, routine 2400 decodes one or more filter indicators from the bitstream. For example, in one embodiment, routine 2400 may decode one or more of fields 1906-1909, as illustrated in FIG. 19 and discussed above.

In block 2425, routine 2400 selects one of the one or more codebooks obtained in block 2403 according to one or more of the decoded filter indicators (e.g., field 1907). In some embodiments, if there was only a single codebook obtained in block 2403, the one or more of the decoded filter indicators may be omitted, and routine 2400 may simply select the single codebook. In block 2426, routine 2400 selects from the selected codebook a set of IC filter coefficients indicated by one or more of the decoded filter indicators (e.g., field 1908). In some embodiments, selecting the set of IC filter coefficients may further include computing a variation or transformation (e.g., a rotation or a mirror) of the set of IC filter coefficients, such as may be indicated by field 1909.

In decision block 2428, routine 2400 determines whether the bitstream has directed routine 2400 to adjust or update the selected set of IC filter coefficients. For example, in one embodiment, such a direction may be transmitted via field 1910. If no update direction has been sent, then in block 2430, routine 2400 configures a IC filter according to the selected set of IC filter coefficients. On the other hand, if an update direction has been sent, then in block 2433, routine 2400 decodes adjustment values (e.g., as sent via field 1911) from the bitstream and updates the selected set of IC filter coefficients according to the adjustment values in block 2435. In block 2430, routine 2400 configures the IC filter according to the updated or adjusted set of IC filter coefficients.

In decision block 2440, routine 2400 determines whether the bitstream has directed routine 2400 to store the updated or adjusted set of IC filter coefficients in the decoder's copy of the codebook so that the updated IC filter coefficients can be re-used. If such a direction has been received, then in block 2443, routine 2400 stores the updated or adjusted set of IC filter coefficients in the decoder's copy of the current codebook.

In block 2445, routine 2400 processes the current picture-portion using the configured IC filter to improve how faithfully the decoded picture-portion reproduces the corresponding portion of the unencoded original picture.

In ending loop block 2448, routine 2400 loops back to block 2420 to process the next picture-portion (if any). In ending loop block 2450, routine 2400 loops back to block 2408 to process the next picture (if any). Once all pictures have been processed, routine 2400 ends in block 2499.

Although specific embodiments have been illustrated and described herein, it will be appreciated by those of ordinary skill in the art that alternate and/or equivalent implementations may be substituted for the specific embodiments shown and described without departing from the scope of the present disclosure. This application is intended to cover any adaptations or variations of the embodiments discussed herein. 

The invention claimed is:
 1. A video-encoder-device-implemented method for encoding a set of impairments-compensation-filter coefficient values for an encoded video frame, the method comprising: by the video encoder device, obtaining an unencoded frame of video; by the video encoder device, encoding the unencoded frame of video into an encoded bitstream by differencing a block of unencoded video in the unencoded frame with a first impairments-compensated predication signal block from a motion compensation process to determine a residual block, transforming the residual block into a block of coefficients, quantizing the block of coefficients into a block of quantized coefficients, and encoding the block of quantized coefficients into the bitstream by an entropy coder; by the video encoder device, reverse quantizing and reverse transforming the block of quantized coefficients into a locally decoded block, assembling the locally decoded block into a locally assembled frame and deblock filtering the locally assembled frame into a deblocked frame; obtaining, by the video encoder device, a codebook including a plurality of sets of impairments-compensation-filter coefficient values suitable for configuring an impairments compensation filter of a video decoder to process frames of encoded videos having a variety of characteristics, wherein the impairments compensation filter compensates for at least one coding artifact produced by a motion compensated transform coding process; by the video encoder device, computing a target set of impairments-compensation-filter coefficient values according to the deblocked frame; during encoding of an unencoded frame of video to generate an encoded bitstream, the video encoder device adaptively selecting from the codebook a set of impairments-compensation-filter coefficient values and forming an impairments-compensated reconstructed frame, which impairments-compensated reconstructed frame is used as a reference frame by the motion compensation process to prepare a second impairments-compensated prediction signal block to improve how faithfully the video decoder reproduces at least a portion of the unencoded frame of video when the set of impairments-compensation-filter coefficient values is used to configure the impairments compensation filter to process at least the portion of the encoded frame; encoding the unencoded frame of video; decoding the encoded frame in a local decoder loop by the video encoder device; and computing a target set of impairments-compensation-filter coefficient values according to the decoded frame and the unencoded frame and forming an impairments-compensated reconstructed frame of video, which impairments-compensated reconstructed frame of video is used as a reference frame for the motion compensated transform coding process; and including in the encoded bitstream generated by the video encoder device an indicator enabling the video decoder to select the selected set of impairments-compensation-filter coefficient values from the video decoder's copy of the codebook.
 2. The method of claim 1, wherein selecting from the codebook the set of impairments-compensation-filter coefficient values comprises selecting from the codebook a set of impairments-compensation-filter coefficient values that substantially fits with the target set of impairments-compensation-filter coefficient values.
 3. The method of claim 2, wherein selecting from the codebook the set of impairments-compensation-filter coefficient values that substantially fits with the target set of impairments-compensation-filter coefficient values comprises: selecting from the codebook an approximately matching set of impairments-compensation-filter coefficient values according to values of one or more representative coefficients of the target set of impairments-compensation-filter coefficient values; selecting a comparison group comprising the approximately matching set of impairments-compensation-filter coefficient values, as well as one or more neighboring sets of impairments-compensation-filter coefficient values; respectively determining a plurality of comparison metrics between the target set of impairments-compensation-filter coefficient values and the sets comprising the comparison group; and selecting from the codebook a set of impairments-compensation-filter coefficient values that substantially fits with the target set of impairments-compensation-filter coefficient values according to the determined plurality of comparison metrics.
 4. The method of claim 3, wherein respectively determining the plurality of comparison metrics comprises respectively determining a plurality of error estimates between the target set of impairments-compensation-filter coefficient values and the comparison group.
 5. The method of claim 3, wherein the codebook is sorted or indexed according to the one or more representative coefficients to facilitate selecting the approximately matching set.
 6. The method of claim 3, wherein the one or more representative coefficients comprises a center coefficient of a Wiener filter.
 7. The method of claim 3, wherein the comparison group further comprises at least one computed variation of at least one of the approximately matching set of impairments-compensation-filter coefficient values and the one or more neighboring sets of impairments-compensation-filter coefficient values.
 8. The method of claim 1, further comprising, during encoding of the unencoded frame of video, computing a variation on the selected set of impairments-compensation-filter coefficient values.
 9. The method of claim 8, wherein computing the variation on the selected set of impairments-compensation-filter coefficient values comprises one of rotating the selected set of impairments-compensation-filter coefficient values and flipping the selected set of impairments-compensation-filter coefficient values.
 10. The method of claim 8, further comprising including in the encoded bitstream generated by the video encoder device a second indicator enabling the video decoder to compute the computed variation on the selected set of impairments-compensation-filter coefficient values.
 11. The method of claim 1, further comprising, during encoding of the unencoded frame of video, adaptively selecting from the codebook a second set of impairments-compensation-filter coefficient values to improve how faithfully the video decoder reproduces a second portion of the unencoded frame of video when the second set of impairments-compensation-filter coefficient values is used to configure the impairments compensation filter to process the second portion of the encoded frame.
 12. The method of claim 1, further comprising including in the encoded bitstream generated by the video encoder device a second indicator enabling the video decoder to identify the portion and the second portion of the encoded frame.
 13. The method of claim 1, further comprising: during the encoding of the unencoded frame of video: determining a plurality of adjustment values for adjusting a respective plurality of the selected set of impairments-compensation-filter coefficient values to further improve how faithfully the video decoder reproduces at least the portion of the unencoded frame of video; and updating the selected set of impairments-compensation-filter coefficient values in the codebook according to the plurality of determined adjustment values; and including, in the encoded bitstream, update data corresponding to the plurality of adjustment values, and an update indication directing the video decoder to update the video decoder's copy of the codebook according to the update data.
 14. The method of claim 13, further comprising, during subsequent encoding of a second unencoded frame of video, including in the encoded bitstream a reset indication directing the video decoder to discard the previously directed update to the video decoder's copy of the codebook.
 15. A non-transitory computer-readable storage medium storing instructions that, when executed by a processor, perform the method of claim
 1. 16. A video-encoding apparatus comprising a processor and a storage medium storing instructions that, when executed by the processor, perform the method of claim
 1. 17. A video-encoder-device-implemented method for encoding a set of impairments-compensation-filter coefficient values for an encoded video frame, the method comprising: obtaining, by the video encoder device, at least two codebooks, the first of the at least two codebooks including a first plurality of sets of impairments-compensation-filter coefficient values suitable for configuring a video-decoder impairments compensation filter of a first filter size to process frames of encoded videos having at least a first image characteristic, the second of the at least two codebooks including a second plurality of sets of impairments-compensation-filter coefficient values suitable for configuring a video-decoder impairments compensation filter of a second filter size to process frames of encoded videos having at least a second image characteristic, wherein said second filter size is smaller than said first filter size; during encoding of an unencoded frame of video to generate an encoded bitstream, the video encoder device: differencing a block of unencoded video in the unencoded frame with a first impairments-compensated predication signal block from a motion compensation process to determine a residual block, transforming the residual block into a block of coefficients, quantizing the block of coefficients into a block of quantized coefficients, and encoding the block of quantized coefficients into the bitstream by an entropy coder; reverse quantizing and reverse transforming the block of quantized coefficients into a locally decoded block, assembling the locally decoded block into a locally assembled frame and deblock filtering the locally assembled frame into a deblocked frame; computing a target set of impairments-compensation-filter coefficient values according to the deblocked frame and the unencoded frame and forming an impairments-compensated reconstructed frame of video, which impairments-compensated reconstructed frame of video is used as a second impairments-compensated predication signal block; determining an image characteristic of the unencoded frame; selecting one of the at least two codebooks based at least in part on the determined image characteristic; and adaptively selecting from the selected codebook a set of impairments-compensation-filter coefficient values to configure the impairments compensation filter to process the encoded frame to compensate for at least one coding artifact produced by a motion compensated transform coding process; and including in the encoded bitstream generated by the video encoder device a first indicator enabling the video decoder to select the selected codebook from the at least two codebooks, and a second indicator enabling the video decoded to select the selected set of impairments-compensation-filter coefficient values from the selected codebook; and further, during encoding of an unencoded frame of video to generate an encoded bitstream, the video encoder device: encoding the unencoded frame of video; decoding the encoded frame in a local decoder loop by the video encoder device; and computing a target set of impairments-compensation-filter coefficient values according to the decoded frame and the unencoded frame and forming an impairments-compensated reconstructed frame of video, which impairments-compensated reconstructed frame of video is used as a reference frame for the motion compensated transform coding process.
 18. The method of claim 17, wherein selecting one of the at least two codebooks based at least in part on the determined image characteristic comprises: determining a target filter size according to the determined image characteristic of the unencoded frame; and selecting a codebook based at least in part on the determined target filter size.
 19. The method of claim 18, wherein determining the image characteristic of the unencoded frame comprises determining a contrast level of the unencoded frame.
 20. The method of claim 19, wherein determining the target filter size according to the determined image characteristic of the unencoded frame comprises determining the target filter size according to the determined contrast level of the unencoded frame.
 21. The method of claim 20, wherein determining the target filter size according to the determined contrast level of the unencoded frame comprises determining a larger filter size when the determined contrast level of the unencoded frame is lower, and determining a smaller filter size when the determined contrast level of the unencoded frame is higher.
 22. The method of claim 18, wherein selecting the one of the at least two codebooks is further based at least in part on an encoding-quality metric associated with the encoding.
 23. The method of claim 22, wherein determining the target filter size according to the determined image characteristic of the unencoded frame comprises determining the target filter size according to the encoding-quality metric.
 24. The method of claim 23, wherein determining the target filter size according to the encoding-quality metric comprises determining a larger filter size when the encoding-quality metric is lower, and determining a smaller filter size when the encoding-quality metric is higher.
 25. The method of claim 17, wherein said first plurality of sets of impairments-compensation-filter coefficient values comprise sets of coefficient values for a selected one of 5×5, 7×7, and 9×9 impairments compensation filters and wherein said second plurality of sets of impairments-compensation-filter coefficient values comprise sets of coefficient values for a different selected one of 5×5, 7×7, and 9×9 impairments compensation filters.
 26. A non-transitory computer-readable storage medium storing instructions that, when executed by a processor, perform the method of claim
 17. 27. A video-encoding apparatus comprising a processor and a storage medium storing instructions that, when executed by the processor, perform the method of claim
 17. 28. A video-encoder-device-implemented method for encoding a set of impairments-compensation-filter coefficient values for an encoded video frame, the method comprising: obtaining, by the video encoder device, a codebook including a plurality of sets of impairments-compensation-filter coefficient values suitable for configuring an impairments compensation filter of a video decoder to process frames of encoded videos having a variety of characteristics; during encoding of an unencoded frame of video to generate an encoded bitstream, the video encoder device: differencing a block of unencoded video in the unencoded frame with a first impairments-compensated predication signal block from a motion compensation process to determine a residual block, transforming the residual block into a block of coefficients, quantizing the block of coefficients into a block of quantized coefficients, and encoding the block of quantized coefficients into the encoded bitstream by an entropy coder; reverse quantizing and reverse transforming the block of quantized coefficients into a locally decoded block, assembling the locally decoded block into a locally assembled frame and deblock filtering the locally assembled frame into a deblocked frame; adaptively selecting from the codebook a set of impairments-compensation-filter coefficient values to configure the impairments compensation filter to process at least the portion of the encoded frame to compensate for at least one coding artifact produced by a motion compensated transform coding process by computing the set of impairments-compensation-filter coefficient values according to the deblocked frame and the unencoded frame and forming an impairments-compensated reconstructed frame of video, which impairments-compensated reconstructed frame of video is used as a second impairments-compensated predication signal block: encoding the unencoded frame of video; decoding the encoded frame in a local decoder loop by the video encoder device; and computing a target set of impairments-compensation-filter coefficient values according to the decoded frame and the unencoded frame and forming an impairments-compensated reconstructed frame of video, which impairments-compensated reconstructed frame of video is used as a reference frame for the motion compensated transform coding process; determining a plurality of adjustment values for adjusting a respective plurality of the selected set of impairments-compensation-filter coefficient values to further improve how faithfully the video decoder reproduces at least the portion of the unencoded frame of video; and encoding the plurality of adjustment values; and including in the encoded bitstream generated by the video encoder device: a selection indicator enabling the video decoder to select the selected set of impairments-compensation-filter coefficient values from the video decoder's copy of the codebook; the encoded plurality of adjustment values; and an adjustment indicator directing the video decoder to adjust the selected set of impairments-compensation-filter coefficient values according to the encoded plurality of adjustment values before configuring the impairments compensation filter to process at least the portion of the encoded frame.
 29. The method of claim 28, wherein the plurality of adjustment values is determined according to a plurality of differential coefficient values representing differences between the target set of impairments-compensation-filter coefficient values and the selected set of impairments-compensation-filter coefficient values.
 30. The method of claim 29, wherein encoding the plurality of adjustment values comprises computing a frequency-domain representation of the plurality of differential coefficient values.
 31. The method of claim 30, wherein encoding the plurality of adjustment values further comprises entropy coding the frequency-domain representation of the plurality of differential coefficient values according to a zigzag scan order ending with a DC coefficient of the frequency-domain representation of the plurality of differential coefficient values.
 32. The method of claim 30, wherein encoding the plurality of adjustment values further comprises masking a plurality of AC coefficients of the frequency-domain representation of the plurality of differential coefficient values.
 33. A non-transitory computer-readable storage medium storing instructions that, when executed by a processor, perform the method of claim
 28. 34. A video-encoding apparatus comprising a processor and a storage medium storing instructions that, when executed by the processor, perform the method of claim
 28. 35. A video-decoder-device-implemented method for decoding a set of impairments-compensation-filter coefficient values for an encoded video frame, the method comprising: obtaining, by the video decoder device, a codebook including a plurality of sets of impairments-compensation-filter coefficient values suitable for configuring an impairments compensation filter to process frames of decoded videos having a variety of characteristics; obtaining an encoded bitstream including the encoded video frame and a selection indicator enabling the video decoder to select a set of impairments-compensation-filter coefficient values from the codebook; during decoding of the encoded video frame, the video decoder device decoding the encoded video into a block of quantized coefficients, reverse quantizing and reverse transforming the block of quantized coefficients into a decoded residual block, adding to the residual block a first impairments-compensated predication signal block from a motion compensation predictor to form a locally decoded block, assembling the locally decoded block into a locally assembled frame and deblock filtering the locally assembled frame into a processed decoded frame of video and the video decoder device selecting from the codebook the set of impairments-compensation-filter coefficient values indicated by the selection indicator and utilizing motion vectors and a motion compensated predictor to produce motion compensated prediction blocks and adding the motion compensated prediction blocks to decoded residual blocks to produce a decoded frame of video; configuring, by the video decoder device, the impairments compensation filter according to the selected set of impairments-compensation-filter coefficient values; processing, by the video decoder device, at least a portion of the decoded frame of video using the configured impairments compensation filter and utilizing motion vectors and the motion compensated predictor to produce a second impairments-compensated predication signal block which may be added to a subsequent decoded residual block, the video decoder device forming an impairments-compensated reconstructed frame of video, which impairments-compensated reconstructed frame of video is used as a reference frame for the motion compensated predictor; and rendering the processed decoded frame of video to a display associated with the video decoder device.
 36. The method of claim 35, wherein the encoded bitstream further includes a second selection indicator enabling the video decoder to select a second set of impairments-compensation-filter coefficient values from the codebook and a portion-identification indicator enabling the video decoder to identify the portion and a second portion of the decoded frame.
 37. The method of claim 36, further comprising: during the decoding of the encoded video frame, the video decoder device selecting from the codebook the second set of impairments-compensation-filter coefficient values indicated by the second selection indicator; re-configuring the impairments compensation filter according to the second selected set of impairments-compensation-filter coefficient values; and processing the second portion of the decoded frame of video using the re-configured impairments compensation filter to further improve how faithfully the decoded frame of video reproduces the corresponding unencoded source-frame of video.
 38. The method of claim 35, wherein the encoded bitstream further includes update data and an update indication directing the video decoder to update the codebook according to the update data.
 39. The method of claim 38, further comprising applying the update data to the selected set of impairments-compensation-filter coefficient values in the codebook before configuring the impairments compensation filter.
 40. The method of claim 39, further comprising, during subsequent decoding of a second encoded frame of video: discarding the previously applied update to the codebook in response to a reset indication included in the encoded bitstream; obtaining, by the video decoder device, a codebook including a plurality of sets of impairments-compensation-filter coefficient values suitable for configuring an impairments compensation filter to process frames of decoded videos having a variety of characteristics; obtaining an encoded bitstream including the encoded video frame and a selection indicator enabling the video decoder to select a set of impairments-compensation-filter coefficient values from the codebook; and during decoding of the encoded video frame, the video decoder device selecting from the codebook the set of impairments-compensation-filter coefficient values indicated by the selection indicator.
 41. The method of claim 35, further comprising: obtaining a second codebook including a second plurality of sets of impairments-compensation-filter coefficient values; and during decoding of the encoded video frame, selecting one of the codebook and the second codebook according to a selection indicator included in the encoded bitstream before selecting from the selected codebook the set of impairments-compensation-filter coefficient values indicated by the selection indicator.
 42. A non-transitory computer-readable storage medium storing instructions that, when executed by a processor, perform the method of claim
 35. 43. A video-decoding apparatus comprising a processor and a storage medium storing instructions that, when executed by the processor, perform the method of claim
 35. 44. A video-decoder-device-implemented method for decoding a set of impairments-compensation-filter coefficient values for an encoded video frame, the method comprising: obtaining, by the video decoder device, a codebook including a plurality of sets of impairments-compensation-filter coefficient values suitable for configuring an impairments compensation filter to process frames of decoded videos having a variety of characteristics; obtaining an encoded bitstream including the encoded video frame, a selection indicator enabling the video decoder to select a set of impairments-compensation-filter coefficient values from the codebook, an encoded plurality of adjustment values, and an adjustment indicator directing the video decoder to adjust the selected set of impairments-compensation-filter coefficient values according to the encoded plurality of adjustment values; during decoding of the encoded video frame, the video decoder device decoding the encoded video frame into a block of quantized coefficients, reverse quantizing and reverse transforming the block of quantized coefficients into a decoded residual block, adding to the residual block a first impairments-compensated predication signal block from a motion compensation predictor to form a locally decoded block, assembling the locally decoded block into a locally assembled frame and deblock filtering the locally assembled frame into a processed decoded frame of video and the video decoder device selecting from the codebook the set of impairments-compensation-filter coefficient values indicated by the selection indicator, and adjusting the selected set of impairments-compensation-filter coefficient values according to the encoded plurality of adjustment values; configuring, by the video decoder device, the impairments compensation filter according to the adjusted selected set of impairments-compensation-filter coefficient values; processing, by the video decoder device, at least a portion of the decoded frame of video using the configured impairments compensation filter and utilizing motion vectors and a motion compensated predictor to produce motion compensated prediction blocks including a second impairments-compensated predication signal block and adding the motion compensated prediction blocks to decoded residual blocks to produce a decoded frame of video, the video decoder device forming an impairments-compensated reconstructed frame of video, which impairments-compensated reconstructed frame of video is used as a reference frame for the motion compensated predictor; and rendering the processed decoded frame of video to a display associated with the video decoder device.
 45. A non-transitory computer-readable storage medium storing instructions that, when executed by a processor, perform the method of claim
 44. 46. A video-decoding apparatus comprising a processor and a storage medium storing instructions that, when executed by the processor, perform the method of claim
 44. 